Skip to content

fix: resolve a conduit key regardless of its hex case - #980

Closed
Dusk1e wants to merge 1 commit into
ProjectOpenSea:mainfrom
Dusk1e:fix/conduit-key-hex-case
Closed

Dusk1e wants to merge 1 commit into
ProjectOpenSea:mainfrom
Dusk1e:fix/conduit-key-hex-case

Conversation

@Dusk1e

@Dusk1e Dusk1e commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

conduitKeyToConduit is indexed with the conduit key exactly as it comes in. A conduit key is a bytes32, so the same value can be written in any hex case, and a key differing only in case misses the lookup. The operator falls out undefined, and what the caller ends up seeing comes from ethers:

unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT)

Nothing there names the conduit, the key, or the config that needed changing.

Five places read that map — the operator approvals are granted to in _formatOrder, the offerer and fulfiller operators in fulfillOrder, and the same two in fulfillOrders. All five are affected, so an order carrying a re-cased key can be neither created nor filled.

This reads as a normalization gap rather than a caller mistake. Everywhere else the SDK compares hex it already lowercases both sides: tokens in findBalanceAndApproval and getSummedTokenAndIdentifierAmounts, operators in getApprovalDedupKey, owners in balanceOf, the recipient in shouldUseBasicFulfill, currencies in areAllCurrenciesSame. Nine of them. The conduit key is the one left keyed on the raw string, and its two sides come from different places — the map is configured by the integrator, the key rides in on order data.

Fix

Lowercase the map as it is built and lowercase the key on the way in, behind a small private helper so all five sites take the same path. A key already matching the configured case resolves exactly as before.

Test

There was no conduit coverage at all — the fixture deploys a ConduitController but no test ever creates a conduit — so test/conduit.spec.ts sets one up off the fixture's own Seaport, opens a channel, and drives creation plus both fulfillment paths.

Three of the four cases stop at the ethers error above without this change. The fourth uses a matching-case key and behaves the same either way, which is what holds the existing path in place.

conduitKeyToConduit is indexed with the conduit key exactly as it arrives.
A conduit key is a bytes32, so the same value can be written in any hex
case, and a key that differs only in case misses the lookup. The operator
comes back undefined and the failure surfaces from ethers as

  unsupported addressable value (argument="target", value=null)

which mentions neither the conduit nor the key.

Five call sites read that map: the operator approvals are granted to at
order creation, the offerer and fulfiller operators on fulfillOrder, and the
same two on fulfillOrders. All five are affected, so an order carrying a
re-cased key cannot be created or filled.

Everywhere else the SDK compares hex it already lowercases both sides --
tokens in findBalanceAndApproval and getSummedTokenAndIdentifierAmounts,
operators in getApprovalDedupKey, owners in balanceOf, the recipient in
shouldUseBasicFulfill, currencies in areAllCurrenciesSame. The conduit key
is the one hex comparison left keyed on the raw string.

Lower case the map when it is built and lower case the key on the way in,
behind a small helper so all five sites go through the same path. A key that
already matches the configured case resolves exactly as before.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.95%. Comparing base (f618d19) to head (4d3fda5).
⚠️ Report is 368 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #980      +/-   ##
==========================================
+ Coverage   98.27%   98.95%   +0.67%     
==========================================
  Files          35       51      +16     
  Lines       14526    18629    +4103     
  Branches      660      988     +328     
==========================================
+ Hits        14276    18435    +4159     
+ Misses        245      187      -58     
- Partials        5        7       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ryanio

ryanio commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this, and for counting the nine other places the SDK already lowercases before concluding the conduit key was the odd one out. That is what makes it read as a normalization gap rather than a caller mistake. Routing all five sites through one helper is the right shape, and adding the first conduit coverage the repo has had is a bonus.

One thing to flag: as submitted this fails biome check, so the lint job went red once the workflow was approved. It is only the formatting of the allOffererOperators arrow, and biome check --write fixes it. Worth running npm run lint locally before pushing, since lint here is tsc plus Biome and is a required check. I have included the formatting fix in the stack.

Reverting the source with your tests in place fails three of the four on the ethers "unsupported addressable value" error, with the matching-case control still passing, so the coverage is doing its job.

This has landed in #985 with seven other contributions from the same day. Closing in favour of that one.

@ryanio ryanio closed this Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants